import request from "@/router/axios";

/**
 * @author fangyu
 * @date 2020/12/4 7:23 下午
 * @version 1.0
 */

export function fetchList(query) {
  return request({
    url: `/product/spuinfo/list/`,
    method: 'get',
    params: query
  })
}

export function fetchDetail(spuId) {
  return request({
    url: `/product/spuinfo/detail/${spuId}`,
    method: 'get'
  })
}

/**
 * 添加商品
 * @param obj
 * @returns {*}
 */
export function addSpu(obj) {
  return request({
    url: '/product/spuinfo',
    method: 'post',
    data: obj
  })
}

/**
 * 修改编辑
 * @param obj
 * @returns {*}
 */
export function putObj(obj) {
  return request({
    url: '/product/spuinfo',
    method: 'put',
    data: obj
  })
}

/**
 * 删除
 * @param id
 * @returns {*}
 */
export function delObj(id) {
  return request({
    url: `/product/spuinfo/${id}`,
    method: 'delete'
  })
}
